<%@page import="itpenguin.entities.Series"%>
<%@page import="itpenguin.common.Util"%>
<%@page import="javax.jdo.Query"%>
<%@page import="itpenguin.common.PMFactory"%>
<%@page import="javax.jdo.PersistenceManager"%>
<%@page import="itpenguin.entities.Article"%>
<%@page import="java.util.List"%>
<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
	<nav>
		<h1>What's new</h1>
		<ul>
<%
	PersistenceManager pm = PMFactory.getInstance().getPersistenceManager();
	Query query = pm.newQuery("select from itpenguin.entities.Article order by published desc");  
	query.setRange(0, 3);
	List<Article> articleList = (List<Article>) query.execute();
	pageContext.setAttribute("articleList", articleList);
%>
			<c:forEach var="newArticle" items="${articleList}">
				<%
					Article newArticle = (Article)pageContext.getAttribute("newArticle");
					Series sr = Util.GetSeries(newArticle.getParentId());
					pageContext.setAttribute("series", sr);
				%>
				<li><fmt:formatDate value="${newArticle.published}" pattern="yyyy/MM/dd"/> 
				${series.title} 
				<a href="/${newArticle.contextName}/${newArticle.id}">${newArticle.title}</a></li>
			</c:forEach>
		</ul>
	</nav>
	<div style="width:300px;">
		<script type="text/javascript"><!--
		google_ad_client = "pub-2855357403949640";
		/* 300x250, IT Penguin */
		google_ad_slot = "9162065787";
		google_ad_width = 300;
		google_ad_height = 250;
		//-->
		</script>
		<script type="text/javascript"
		src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
		</script>
	</div>
	<nav>
<%
	List<Series> seriesList = Util.GetChildSheries(null);
	pageContext.setAttribute("seriesList", seriesList);
%>
		<h1>Contents</h1>
		<ul>
		<c:forEach var="series" items="${seriesList}">
			<c:set var="series" value="${series}" scope="request"/>
			<li>
				<jsp:include page="seriesOnly.jsp" />
			</li>
		</c:forEach>
		</ul>
	</nav>
	<nav>
		<h1>My Blogs</h1>
		<ul>
			<li><a href="http://hiroatsu.blogspot.com/">旅ナシズム</a><span>筆者の旅日記</span></li>
			<li><a href="http://blog.livedoor.jp/hiroatsu/">世界アルペン遺産</a><span>日本各地に散見する三角屋根の謎に迫る</span></li>
			<li><a href="http://election.it-penguin.com/">国政選挙 議席予想・速報 まとめ</a><span>国政選挙 選挙特番観察記</span></li>
		</ul>
	</nav>
	<div style="border:dotted 1px #001122; margin:0 auto 1em; width:200px; height:90px; padding:0.5em;">
		<script type="text/javascript"><!--
		google_ad_client = "pub-2855357403949640";
		/* 200x90, IT Penguin Link Unit */
		google_ad_slot = "4973086734";
		google_ad_width = 200;
		google_ad_height = 90;
		//-->
		</script>
		<script type="text/javascript"
		src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
		</script>
	</div>
	<div style="text-align:center;padding-bottom:1em;">
		<img src="http://code.google.com/appengine/images/appengine-silver-120x30.gif" 
		alt="Powered by Google App Engine"/>
	</div>